<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>输入一个整数,按顺序(从个位到高位)输出这个整数每个位置的数字</title>
  </head>
  <body>
    <script>
      var num = prompt("请输入一个整数");
      for (var i = 1; i <= num; i *= 10) {
        console.log(parseInt(num / i) % 10);
      }
    </script>
  </body>
</html>
